#include <iostream>
#include "point.h"
#include "stdio.h"
#include "namePoint.h"
#include "file.h"

void test_const();
void test_point();
void test_namePoint();
void test_file();

int main() {
    return 0;
}

void test_file() {
    init_it(-1);
    ASTDIN->read();
}

void test_namePoint() {
    NamePoint *p0 = makeNamePoint(0, 0, "origin point");
    NamePoint *p1 = makeNamePoint(3, 4, "upper right");
    printf("p0's name = %s \n", getName(p0));
    printf("p1's name = %s \n", getName(p1));
    // 因为NamePoint是Point的超集，所以可以将NamePoint强转成Point【这也是c++实现单继承的方法】
    double dis = distance((Point *)p0, (Point *)p1);
    printf("distance of NamePoint p0 and NamePoint p1 is %f \n", dis);
}

void test_point() {
    Point *p1 = makePoint(4, 3);
    Point *p2 = makePoint(0, 0);
    double dis = distance(p1, p2);
    printf("reuslt = %f \n", dis);
}




































/*
void test_const() {
    using namespace std;
    int aNum = 10;
    int bNum = 20;

    //1. 指针是const的，但是数据不是const的
    int * const aConst = &aNum;
    // 编译报错:cannot assign to variable 'aConst' with const-qualified type 'int *const'
    // aConst = &bNum; 
    //2. 指针指向的数据是const的
    int const *bConst = &aNum;
    //Error: read-only variable is not assignable
    // *bConst = 30;
    //3. 同情况2
    const int *cConst = &aNum;
    //Error: read-only variable is not assignable
    // *cConst = 30;
    aNum = 11;

    cout << "aConst : " << *aConst << endl;
    cout << "bConst : " << *bConst << endl;
}
*/